#include <reg52.h>
#include "key.h"

code uint8 number[]={0xc0,0xf9,0xa4,0xb0,0x99,
					 0x92,0x82,0xf8,0x80,0x90,
					 0xFF
				};
int8 n=0;
void delay();
void main()
{
	KeyOut1=0;
	P0=number[0];
	ENLED=0;ADDR3=1;
	ADDR0=0;ADDR1=0;ADDR2=0;
	while(1)
	{
		if(!KeyInt1)
		{
			delay();
			if(!KeyInt1)
			{
				if(9==n){
					n=0;
				}else{
					n++;
				}
				P0=number[n];
				while(!KeyInt1);
			}
		}
		if(!KeyInt2)
		{
			delay();
			if(!KeyInt2){
				if(0==n){
					n=0;
				}else{
					n--;
				}
				P0=number[n];
				while(!KeyInt2);
			}
		}
	}
}

void delay()
{
	uint16 i=1000;
	while(i--);
}
